home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 5545 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  932 b 

  1. Path: cypher.3do.com!user
  2. From: tsw@3do.com (Tom Watson)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Character String --> Integer
  5. Date: Wed, 07 Feb 1996 18:58:33 -0800
  6. Organization: The 3DO Corporation
  7. Distribution: world
  8. Message-ID: <tsw-0702961858330001@cypher.3do.com>
  9. References: <4fb0ga$lsa@remus.rutgers.edu>
  10. NNTP-Posting-Host: cypher.3do.com
  11.  
  12. In article <4fb0ga$lsa@remus.rutgers.edu>, wempa@remus.rutgers.edu (Force
  13. Of Nature) wrote:
  14.  
  15. > Is there an easy way to convert a character string such as '2425' to the
  16. > integer 2425 ???  The only way I can think of is to pick off characters 
  17. > one at a time and use switch statements to determine the value (0-9) and
  18. > then multiply by the correct power of 10.  Is there an easier way to do
  19. > this ???????
  20.  
  21. Try the routine 'atoi' or its friends:
  22. 'strtol', 'fscanf', or 'atol'
  23.  
  24. See your fine manual for more on these items.
  25.  
  26. -- 
  27. Tom Watson
  28. tsw@3do.com         (Home: tsw@johana.com)
  29.